/* (c) 2013 Fyren, see license.txt */

#include "whatiah.h"

int main()
{
	initWhatiah();

	Deck playerDeck =
	{
		charms[wornLeatherChest],
                charms[wornLeatherChest],
                charms[wornLeatherChest],
                charms[wornLeatherChest],
                charms[wornLeatherChest],
                charms[leatherPants],
                charms[leatherPants],
                charms[leatherPants],
                charms[leatherPants],
                charms[smallGlyph],
                charms[smallGlyph],
                charms[smallGlyph],
                charms[smallGlyph],
                charms[shoulderGlyph],
                charms[ratCloak],
                charms[ratCloak],
                charms[bronzeHelm],
                charms[bronzeHelm],
                charms[bronzeHelm],
	};
	Mob *player = new Mob("Player", 67, playerDeck);

	int cd = 0;
	int dead = 0;
	int survive = 0;
	int spirit = 0;
	int nothing = 0;
	int HP = 0;
	int SP = 0;
	int deadTurn = 0;
	int aliveTurn = 0;
	int fights = 1000000;
	Mob *enemy = mobs[prairieSprite];
	Fight f({player}, {enemy});
	for (int i = 0; i < fights; i++)
	{
		f.initMobs();
		f.start();

		if (!player->alive) dead++;
		else if (player->SP <= floor(player->maxSP * 0.1) && player->HP <= floor(player->maxHP * 0.1)) cd++;
		else if (player->SP <= floor(player->maxSP * 0.1)) spirit++;
		else if (player->HP <= floor(player->maxHP * 0.1)) survive++;
		else nothing++;

		if (player->alive) 
		{
			aliveTurn += f.turn;
			HP += player->HP;
			SP += player->SP;
		}
		else deadTurn += f.turn;
		
	}
	std::cout << "Died: " << (float) dead / fights << " (turn " << (dead ? (float) deadTurn / dead : 0) << ")" << std::endl;
	std::cout << "HP/SP: " << (float) HP / (fights - dead) << " / " << (float) SP / (fights - dead) << " (turn " << (fights - dead ? (float) aliveTurn / (fights - dead) : 0) << ")" << std::endl;
	std::cout << "CD: " << (float) cd / fights << std::endl;
	std::cout << "Spirit: " << (float) spirit / fights << std::endl;
	std::cout << "Survive: " << (float) survive / fights << std::endl;
	std::cout << "Other: " << (float) nothing / fights << std::endl;


        return 0;
}
